<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <script src="vue.js"></script>
    <title>Document</title>
    
</head>
<body>
    <main id="app">
        <img @mousedown.prevent="down($event)":style="imgStyle" :src="'image/'+index+'.png'" alt="">
    </main>
    <script>
        var vue=new Vue({
            el:'#app',
            data:{
                index:0,
                downAddress:0
            },
            computed: {
                imgStyle:function(){
                    return{
                        width:'100%',
                        height:'600px',
                    }
                }
            },
            methods:{
                down:function(e){
                    this.downAddress=e.pageX
                  var that=this
                  var move=function(el){
                      that.updatePoint(el)
                  }
                  document.addEventListener('mousemove',move)
                  document.addEventListener('mouseup',function(){
                      document.removeEventListener('mousemove',move)
                  })
                
                },
                updatePoint:function(el){
                    var pointX=el.pageX
                    if(this.downAddress>pointX){
                        if(this.index==35){
                            this.index=0
                        }
                        this.index++
                    }
                    if(this.downAddress<pointX){
                        if(this.index==0){
                            this.index=35
                        }
                        this.index--
                    }
                    this.downAddress=pointX
                }
            },
        })
    </script>
</body>
</html>